package com.kaifamiao.www.demo.Do26.Zuoye;

import java.util.Random;

public class Test02 {
    public static void main(String[] args) {
        Tree tree=new Tree();
        Random a =new Random();
       for(int i = 1;i <= 10;i++){
           int q =a.nextInt(3);
           if(q==0){
               tree.water();
           } else if(q==1){
               tree.parasite();
           } else{
               tree.insecticide();
           }

           if(tree.health <=0){
               System.out.println("很抱歉，树死了。在第"+i+"次");
               break;
           }
       }
        System.out.println("树的健康值是"+tree.health);
    }
}
